home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / qbsnip.zip / DOW.BAS < prev    next >
BASIC Source File  |  1997-06-20  |  1KB  |  43 lines

  1. ' DOW.BAS
  2. '
  3. ' Donated to the public domain
  4. ' No warranties or guarantees are expressed or implied.
  5. '
  6. ' Purpose: Outputs the date, including day of week in full text format.
  7.  
  8. DECLARE FUNCTION DOW$ ()
  9.  
  10. '$INCLUDE: 'qb.bi'      'load qb with the /L switch
  11.  
  12. PRINT "Today is "; DOW$
  13.  
  14. FUNCTION DOW$
  15. DIM InRegs AS RegType, OutRegs AS RegType, Day$(7), Month$(12)
  16.  
  17. 'Days of the week
  18. Day$(0) = "Sunday": Day$(1) = "Monday": Day$(2) = "Tuesday"
  19. Day$(3) = "Wednesday": Day$(4) = "Thursday": Day$(5) = "Friday"
  20. Day$(6) = "Saturday"
  21.  
  22. 'Month Names
  23. Month$(1) = "January": Month$(2) = "February": Month$(3) = "March"
  24. Month$(4) = "April": Month$(5) = "May": Month$(6) = "June"
  25. Month$(7) = "July": Month$(8) = "August": Month$(9) = "September"
  26. Month$(10) = "October": Month$(11) = "November": Month$(12) = "December"
  27.  
  28. 'Interrupt 21 Function 2AH - get date
  29. InRegs.ax = &H2A * 256   '2Ah in ah
  30. CALL INTERRUPT(&H21, InRegs, OutRegs)
  31.  
  32. ' cx is the year, dh is the month, dl is the date, al is the day
  33. year% = OutRegs.cx
  34. monthnum% = OutRegs.dx \ 256
  35. dt% = OutRegs.dx MOD 256
  36. dayofweek% = OutRegs.ax MOD 256
  37.  
  38. 'Return the Date String as, for example: Wednesday, October 9, 1996
  39. DOW$ = Day$(dayofweek%) + ", " + Month$(monthnum%) + STR$(dt%) + "," + STR$(year%)
  40.  
  41. END FUNCTION
  42.  
  43.